package com.xkk.service;

import com.xkk.pojo.Employee;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
@Mapper
@Repository
@ResponseBody
public interface EmployeeService {
    @Select("select*from employee")
    List<Employee> selectAllEmployee();
    //根据id查询员工信息
    @Select("select*from employee where id = #{id}")
    Employee selectEmployeeById(int id);
    //添加一个员工信息
    //@Insert("insert into mybatis01.employee(id,lastName,email,gender,department,birth) values(#{id},#{lastName},#{email},#{gender},#{department},#{birth})")
    @Insert("insert into employee (id,lastName,email,gender,hobby,birth) values(#{id},#{lastName},#{email},#{gender},#{hobby},#{birth})")
    int addEmployee(Employee employee);
    //修改一个员工信息
    @Update("update employee set id=#{id},lastName=#{lastName},email=#{email},gender=#{gender},hobby=#{hobby},birth=#{birth} where id = #{id}")
    int updateEmployee(Employee employee);
    //根据id删除员工信息
    @Delete("delete from employee where id=#{id}")
    int deleteEmployee(int id);
}
